home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
basic
/
gtshape.lha
/
GTShape_Fixes
/
gtshape_fix.asc
next >
Wrap
Text File
|
1999-02-28
|
2KB
|
91 lines
; Description: Example of GTShape gadgets not working and how to fix them.
; Type: Intuition
;
; BUGS: Well, there should be one with the image highlighted gadgets,
; in that the correct image is not shown for all gadgets.
; Strange then that the bug is that it actually works properly!
DEFTYPE.w
WBStartup
WbToScreen 0
WBenchToFront_
; Create a bitmap for grabbing shapes from
BitMap 0,16,16,4
; Draw first shape - a 16 colour image. GTShapes normally only let you
; display 4 colours. Make sure your workbench is at least 16 colour.
For i.w=0 To 3
For j.w=0 To 3
Boxf j*4,i*4,j*4+4,i*4+4,i*4+j
Next
Next
GetaShape 0,0,0,16,16
; The four remaining shapes are to illustrate the problem with different
; highlight shapes in Blitz 2. All highlight shapes end up as the last one
; used. The two gadgets should be:
; (un)filled rectangle when (un)selected
; (un)filled circle when (un)selected
; These are shapes which only use less than the fourth colour, but it
; is possible to add the two problems (i.e. <>4 colour shapes with shape
; highlights)
Cls
Box 2,2,13,13,1
GetaShape 1,0,0,16,16
Boxf 2,2,13,13,1
GetaShape 2,0,0,16,16
Cls
Circle 8,8,4,1
GetaShape 3,0,0,16,16
Circlef 8,8,4,1
GetaShape 4,0,0,16,16
; Now create our problem gadgets
GTShape 0,0,10,30,0,0
GTShape 0,1,30,30,0,1,2
GTShape 0,2,50,30,0,3,4
; And our fixed gadgets
; First of all, fix the <>4 colour problem
GTShape 0,3,160,30,0,0
*g.Gadget=GTGadPtr(0,3) ; Get pointer to gadget
*gi.Image=*g\GadgetRender ; Get pointer to image of unselected gadget
*s.shape=Addr Shape(0) ; Pointer to shape we have used as image
new_planepick.b=0
For i=0 To *s\_depth-1
new_planepick = new_planepick | (1 LSL i)
Next
*gi\PlanePick = new_planepick
GTShape 0,4,180,30,0,1,2
GTShape 0,5,200,30,0,3,4
Window 0,0,0,320,200,#WFLG_SIZEGADGET|#WFLG_ACTIVATE|#WFLG_CLOSEGADGET|#WFLG_DRAGBAR|#WFLG_DEPTHGADGET,"Test",-1,-1
DefaultOutput
AttachGTList 0,0
; Print some headings
WLocate 10,10
NPrint "Problem gadgets"
WLocate 150,10
NPrint "Fixed gadgets"
;For i=0 To 4
; WBlit i,i*20,100
;Next
While ev.l<>#IDCMP_CLOSEWINDOW
ev=WaitEvent
Select ev
Case #IDCMP_GADGETUP
NPrint "Gadget hit=",GadgetHit
End Select
Wend
DetachGTList 0
End